import axios from "axios";

export default function(account) {
    // 获取用户信息
    let params = account ? { account } : undefined
    return axios({
        method: "get",
        url: "/users/info",
        params,
        header: {
            Authorization: localStorage.getItem("Authorization")
        }
    })
        .then(response => {
            // username不为空时候表示查询操作可行
            return {
                result: true,
                data: response.data
            }
        })
        .catch(error => {
            return {
                result: false,
                msg: error.response.data.msg
            }
        })
}